﻿using System;
using Jayden.Dll.Web.Enums;
using Jayden.Dll.Web.HtmlControls.Descriptions;
using Jayden.Dll.Web.HtmlControls.Generics;
using Jayden.Dll.Web.HtmlControls.Interfaces;

namespace Jayden.Dll.Web.HtmlControls
{
	public class Audio : HtmlElement, WithSrc, WithAutoPlay, WithControls, WithMuted, WithLoop
	{
		public Audio() : base(AudioDescription.Instance) { }

		public string PreLoad { get { return this["preload"]; } set { this["preload"] = value; } }
		public bool AutoPlay { get { return GetAttributeBool("autoplay"); } set { SetAttribute("autoplay", value); } }
		public bool Controls { get { return GetAttributeBool("controls"); } set { SetAttribute("controls", value); } }
		public bool Loop { get { return GetAttributeBool("loop"); } set { SetAttribute("loop", value); } }
		public bool Muted { get { return GetAttributeBool("muted"); } set { SetAttribute("muted", value); } }
		public string MediaGroup { get { return this["mediagroup"]; } set { this["mediagroup"] = value; } }
		public string Src { get { return this["src"]; } set { this["src"] = value; } }
	}
	public class AudioDescription : HtmlElementDescription
	{
		public static readonly AudioDescription Instance = new AudioDescription();
		private AudioDescription() : base("audio", HtmlVersion.Html5, true, true) { }
		public override Type ControlType { get { return typeof(Audio); } }
		public override string Description { get { return "audio stream."; } }
	}
}
